<template>
  <div class="comment-info" v-if="Object.keys(commentInfo).length !== 0">
    <div class="comment-header">
      <div class="header-title">用户评论</div>
      <div class="header-more">更多</div>
    </div>
    <div class="comment-user">
      <img :src="commentInfo.user.avatar" alt="" />
      <span>{{ commentInfo.user.uname }}</span>
    </div>
    <div class="comment-content">
      <p>{{ commentInfo.content }}</p>
      <div class="comment-content-others">
        <span>{{ commentInfo.created | showDate }}</span>
        <span>{{ commentInfo.style }}</span>
      </div>
    </div>
    <div class="comment-img">
      <img
        :src="item"
        alt=""
        v-for="(item, index) in commentInfo.images"
        :key="index"
      />
    </div>
  </div>
</template>

<script>
export default {
  name: "DetailCommentInfo",
  props: {
    commentInfo: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  filters: {
    showDate(value) {
      const date = new Date(value * 1000);
      return date;
    },
  },
};
</script>

<style>
.comment-header {
  height: 80px;
  line-height: 80px;
}
.header-title {
  float: left;
  font-size: 18px;
  padding-left: 20px;
}
.header-more {
  float: right;
  padding-right: 20px;
  font-size: 16px;
  font-weight: 700;
}
.comment-user {
  padding: 10px 10px;
}
.comment-user img {
  width: 50px;
  height: 50px;
  vertical-align: middle;
}
.comment-user span {
  font-size: 18px;
  vertical-align: middle;
  margin-left: 10px;
}
.comment-content {
  font-size: 16px;
  padding: 10px 10px;
}
.comment-content-others {
  margin-top: 5px;
  color: rgb(139, 136, 136);
}
.comment-content-others span {
  padding-left: 6px;
}
.comment-img {
  margin-left: 20px;
}
.comment-img img {
  width: 60px;
  height: 60px;
}
</style>